<?php

	class product_image_DAO extends CI_Model{

		public function __construct(){
			parent::__construct();
			$this->load->database();
		}
		
		public function get($product_id){
			$this->db->where('product_id', $product_id);
			$query = $this->db->get("product_image");
			return $query->result_array();
		}

		public function getAll(){
			$query = $this->db->get("product_image");
			return $query->result_array();
		}
		
		public function add($product_image){
			$this->db->insert("product_image", $product_image);
			return ($this->db->affected_rows() != 1) ? false : true;
		}
		
		public function delete($product_id, $ordinal){
			$this->db->where('product_id', $product_id);
			$this->db->where('ordinal', $ordinal);
			$this->db->delete('product_image');
			return ($this->db->affected_rows() != 1) ? false : true;
		}
	}

?>